package com.zhu.gmallpublisher.bean;

import com.sun.xml.internal.ws.developer.StreamingAttachment;
import lombok.AllArgsConstructor;
import lombok.Data;

/**
 * 新老访客
 */
@Data
@AllArgsConstructor
public class TrafficVisitorTypeStats {

    String isNew;

    Long uvCt;  //独立访客

    Long pvCt;  //页面浏览

    Long svCt;  //会话

    Long ujCt;  //跳出

    Long durSum; //累计访问时长

    // 跳出率
    public Double getUjRate(){
        if(svCt == 0) {
            return 0.0;
        }
        return (double)ujCt/(double)svCt;
    }
    // 会话平均在线时长（秒）
    public Double getAvgDurSum() {
        if(svCt == 0) {
            return 0.0;
        }
        return (double)durSum/(double) svCt / 1000;
    }
    // 会话平均访问页面数
    public Double getAvgPvCt(){
        if(svCt == 0) {
            return 0.0;
        }
        return (double)pvCt / (double) svCt;
    }





}
